package com.yx.filemanager;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.yx.filemanager.util.FileUtils;

/**
 * Created by yx on 2017/8/31 0031.
 */

public class FileManagerActivity extends AppCompatActivity {
    private String path;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 无标题
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        CustomUtil.setTranslucentStatus(this, R.color.colorPrimary);
        setContentView(R.layout.activity_file_manager);
        // 设置竖屏
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        TextView tv_memory = (TextView) findViewById(R.id.tv_memory);
        TextView tv_sd = (TextView) findViewById(R.id.tv_sd);
        TextView tv_external_sd = (TextView) findViewById(R.id.tv_external_sd);

        // 手机内存
        tv_memory.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(FileManagerActivity.this, FileActivity.class);
                path = FileUtils.getInnerPath();
                intent.putExtra("path", path);
                startActivity(intent);
            }
        });

        //内置SD卡
        tv_sd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(FileManagerActivity.this, FileActivity.class);
                path = FileUtils.getInnerSDPath();
                intent.putExtra("path", path);
                startActivity(intent);
            }
        });

        //内置SD卡
        tv_external_sd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(FileManagerActivity.this, FileActivity.class);
                path = FileUtils.getExtSDCardPath(FileManagerActivity.this);
                intent.putExtra("path", path);
                startActivity(intent);
            }
        });


    }
}
